// components/authorization/index.js
Component({
  data: {
    isLogin: false,
  },
  lifetimes: {
    attached() {
      const pages = getCurrentPages()
      const currentUrl = pages[pages.length - 1].route


      const app = getApp()
      const isLogin = !!app.getToken();
      this.setData({ isLogin })
      if (!isLogin) {
        wx.navigateTo({
          url: '/pages/login/index?redirector=' + currentUrl,
        })
      }
    },
  },

  methods: {},
})

